
package game;

import java.util.HashMap;
import java.util.Map;

import boundaryToMatador.GUI;

public class GUIout {
	private Map<String, String> translations;
	public GUIout() {
		this.translations = new HashMap<String, String>();
	}
	
	public void setTranslations(HashMap<String,String> translations) {
		this.translations = translations;
	}

	public void startGUI() {
		GUI.create("fields1.txt");
	}
	
	public void closeGUI() {
		GUI.close();
	}
	
	public void welcomeText() {
		GUI.showMessage(translations.get("GUI_OUT_WELCOME"));
	}
	
	public void turnText(String name) {
		GUI.getUserButtonPressed(name+this.translations.get("GUI_OUT_TURN_TO_ROLL"), this.translations.get("GUI_OUT_ROLL"));
	}
	
	public void setBalance(String name, int account) {
		GUI.setBalance(name, account);
	}
	
	public void removeCar(int fieldNumber, String name) {	
		GUI.removeCar(fieldNumber, name);
	}

	public void setCar(int fieldNumber, String name) {
		GUI.setCar(fieldNumber, name);
	}
	
	public void setDices(int[] dices) {
		GUI.setDice(dices[0], dices[1]);
	}

	public void landOnField(String fieldName) {
		GUI.showMessage(this.translations.get("GUI_OUT_LANDED_ON_FIELD") +" "+ fieldName );
	}
	
	public void landOnElsesField(int rentValue) {
		GUI.getUserButtonPressed(this.translations.get("GUI_OUT_OWNED_BY_OPPONENT")+" ("+rentValue+" DKK)", this.translations.get("GAME_PAY"));
	}
	
	public void landOnLabor(String fieldName) {
		GUI.getUserButtonPressed(this.translations.get("GUI_OUT_LANDED_ON")+fieldName+". "+this.translations.get("GUI_OUT_ROLL_FOR_RENT"), this.translations.get("GUI_OUT_ROLL"));
	}
	
	public void landOnTax() { 
		GUI.showMessage(this.translations.get("GUI_OUT_LANDED_ON_TAX"));
	}

	public void landOnRefuge(String playerName) { 
		GUI.showMessage(playerName+", "+this.translations.get("GUI_OUT_RECEIVED_BONUS"));
	}
	
	public void playerHasLost(String name, int field) {
		GUI.showMessage(name + " "+this.translations.get("GUI_OUT_LOST")+" "+this.translations.get("GUI_OUT_REST_PLAYING"));
		GUI.removeCar(field, name);
		GUI.showMessage(name + " "+this.translations.get("GUI_OUT_PROPERTIES_OWNABLE"));
	}
	
	public void playerHasWon(String name) {
		GUI.showMessage(name+" "+this.translations.get("GUI_OUT_PLAYER_WON"));
	}
	
	public void landAsOwner() { 
		GUI.showMessage(this.translations.get("GUI_OUT_LANDED_OWN_FIELD"));
	}
	
	public void landOnChance() {
		GUI.showMessage(this.translations.get("GUI_OUT_LANDED_CHANCE_FIELD"));
	}
	
	public void hasFreedom(){
		GUI.showMessage(this.translations.get("GUI_OUT_GOT_FREEDOM_CHANCE_CARD"));
	}
	
	public void testMessage(String msg){
		GUI.showMessage(msg);
	}
	
	public void landOnJail() { 
			GUI.showMessage(this.translations.get("GUI_OUT_IN_JAIL"));
	}

	public void GotoJail() { 
		GUI.showMessage(this.translations.get("GUI_OUT_GOTO_JAIL"));
	}

	public void goBack() {
		GUI.showMessage(this.translations.get("GUI_OUT_GO_BACK"));
	}
	
	public String getTranslation(String key) {
		if (this.translations.containsKey(key)) {
			return this.translations.get(key);
		} else {
			return key;
		}
	}


	public void landOnMortgagedField() {
		GUI.showMessage(this.translations.get("GUI_OUT_MORTGAGED_FIELD"));
	}
}
